{include file="public/header"}

<body>
  <div class="layui-fluid">
    <div class="layui-row">
      {if !empty($row.newdata) && is_array($row.newdata) && count($row.newdata) > 0}
      <table class="layui-table">
        <h3 style="text-align: center;margin:20px;font-weight: bold;">{$row.yeardays|default=''}月督导申请表</h3>
        <colgroup>
          <col width="150">
          <col width="200">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th width="70">日期</th>
            <th width="50">组别</th>
            <th width="120">打卡地址</th>
            <th width="70">客户</th>
            <th width="70">考勤类型</th>
            <th width="70">实施天数</th>
            <th width="100">回款情况</th>
            <th width="70">面积</th>
            <th width="120">店铺信息</th>
            <th width="70">照片违规</th>
            <th width="70">迟到(次)</th>
            <th width="70">早退(次)</th>
            <th width="70">缺卡(次)</th>
            <th width="70">旷工/休假(次)</th>
            <th width="70">是否跨月</th>
          </tr>
        </thead>
        <tbody>
          {foreach $row.newdata as $k => $olddata}
          <tr>
            <td {if isset($row.olddata[$k]['date']) && isset($olddata.date) && $row.olddata[$k]['date']
              !=$olddata.date}style="color:red" {/if}>
              {$olddata.date|default=''}</td>
            <td {if isset($row.olddata[$k]['groups']) && isset($olddata.groups) && $row.olddata[$k]['groups']
              !=$olddata.groups}style="color:red" {/if}>{$olddata.groups|default=''}</td>
            <td {if isset($row.olddata[$k]['address']) && isset($olddata.address) && $row.olddata[$k]['address']
              !=$olddata.address}style="color:red" {/if}>{$olddata.address|default=''}</td>
            <td {if isset($row.olddata[$k]['kehuname']) && isset($olddata.kehuname) && $row.olddata[$k]['kehuname']
              !=$olddata.kehuname}style="color:red" {/if}>{$olddata.kehuname|default=''}</td>
            <td {if isset($row.olddata[$k]['type']) && isset($olddata.type) && $row.olddata[$k]['type']
              !=$olddata.type}style="color:red" {/if}>{$olddata.type|default=''}</td>
            <td {if isset($row.olddata[$k]['days']) && isset($olddata.days) && $row.olddata[$k]['days']
              !=$olddata.days}style="color:red" {/if}>{$olddata.days|default=''}</td>
            <td {if isset($row.olddata[$k]['weikuan']) && isset($olddata.weikuan) && $row.olddata[$k]['weikuan']
              !=$olddata.weikuan}style="color:red" {/if}>{$olddata.weikuan|default=''}</td>
            <td {if isset($row.olddata[$k]['areas']) && isset($olddata.areas) && $row.olddata[$k]['areas']
              !=$olddata.areas}style="color:red" {/if}>{$olddata.areas|default=''}</td>
            <td {if isset($row.olddata[$k]['dpxx']) && isset($olddata.dpxx) && $row.olddata[$k]['dpxx']
              !=$olddata.dpxx}style="color:red" {/if}>{$olddata.dpxx|default=''}</td>
            <td {if isset($row.olddata[$k]['weigui']) && isset($olddata.weigui) && $row.olddata[$k]['weigui']
              !=$olddata.weigui}style="color:red" {/if}>{$olddata.weigui|default=''}</td>
            <td {if isset($row.olddata[$k]['chidao']) && isset($olddata.chidao) && $row.olddata[$k]['chidao']
              !=$olddata.chidao}style="color:red" {/if}>{$olddata.chidao|default=''}</td>
            <td {if isset($row.olddata[$k]['zaotui']) && isset($olddata.zaotui) && $row.olddata[$k]['zaotui']
              !=$olddata.zaotui}style="color:red" {/if}>{$olddata.zaotui|default=''}</td>
            <td {if isset($row.olddata[$k]['queka']) && isset($olddata.queka) && $row.olddata[$k]['queka']
              !=$olddata.queka}style="color:red" {/if}>{$olddata.queka|default=''}</td>
            <td {if isset($row.olddata[$k]['kuanggong']) && isset($olddata.dakuanggongte) &&
              $row.olddata[$k]['kuanggong'] !=$olddata.kuanggong}style="color:red" {/if}>{$olddata.kuanggong|default=''}
            </td>
            <td {if isset($row.olddata[$k]['kuayue']) && isset($olddata.kuayue) && $row.olddata[$k]['kuayue']
              !=$olddata.kuayue}style="color:red" {/if}>{$olddata.kuayue|default=''}</td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      {if !empty($row.status) && $row.status == 1}
      <form action="" method="post" class="layui-form layui-form-pane">
        <div class="layui-form-item">
          <input type="hidden" value="{$row['id']|default='0'}" name="id" />
          <button class="layui-btn" lay-submit="" lay-filter="tongguo">审核通过(审核通过后，用户列表导出数据将替换成审核后的数据)</button>
          <button class="layui-btn layui-btn-danger" lay-submit=""
            lay-filter="bohui">审核驳回(审核通过后，用户列表导出数据依然是原始表数据)</button>
        </div>
      </form>
      {/if}
      {/if}
      {if !empty($row.olddata) && is_array($row.olddata) && count($row.olddata) > 0}
      <table class="layui-table">
        <h3 style="text-align: center;margin:20px;font-weight: bold;">{$row.yeardays|default=''}月原始表(供参考数据变化)</h3>
        <colgroup>
          <col width="150">
          <col width="200">
          <col>
        </colgroup>
        <thead>
          <tr>
            <th width="70">日期</th>
            <th width="50">组别</th>
            <th width="120">打卡地址</th>
            <th width="70">客户</th>
            <th width="70">考勤类型</th>
            <th width="70">实施天数</th>
            <th width="100">回款情况</th>
            <th width="70">面积</th>
            <th width="120">店铺信息</th>
            <th width="70">照片违规</th>
            <th width="70">迟到(次)</th>
            <th width="70">早退(次)</th>
            <th width="70">缺卡(次)</th>
            <th width="70">旷工/休假(次)</th>
            <th width="70">是否跨月</th>
          </tr>
        </thead>
        <tbody>
          {foreach $row.olddata as $olddata}
          <tr>
            <td>{$olddata.date|default=''}</td>
            <td>{$olddata.groups|default=''}</td>
            <td>{$olddata.address|default=''}</td>
            <td>{$olddata.kehuname|default=''}</td>
            <td>{$olddata.type|default=''}</td>
            <td>{$olddata.days|default=''}</td>
            <td>{$olddata.weikuan|default=''}</td>
            <td>{$olddata.areas|default=''}</td>
            <td>{$olddata.dpxx|default=''}</td>
            <td>{$olddata.weigui|default=''}</td>
            <td>{$olddata.chidao|default=''}</td>
            <td>{$olddata.zaotui|default=''}</td>
            <td>{$olddata.queka|default=''}</td>
            <td>{$olddata.kuanggong|default=''}</td>
            <td>{$olddata.kuayue|default=''}</td>
          </tr>
          {/foreach}
        </tbody>
      </table>
      {/if}
    </div>
  </div>
  {include file="public/footer"}
  <script>
    layui.use(["form", "layer", "upload"], function () {
      $ = layui.jquery;
      var form = layui.form,
        upload = layui.upload,
        element = layui.element,
        layer = layui.layer;
      form.on('select(type)', function (data) {
        var type = data.value;
        if (type == 3 || type == 2) {
          $('#provinceshow').show();
        } else {
          $('#provinceshow').hide();
        }
      });
      //监听提交
      form.on("submit(bohui)", function (data) {
        data.field.status = 3;
        //发异步，把数据提交给php
        $.ajax({
          type: "post",
          data: data.field,
          success: function (res) {
            if (res.status == 0) {
              layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                parent.location.reload();
                parent.layer.close(index);
              });
            } else {
              layer.msg(res.msg, { icon: 2, time: 1000 });
            }
          },
        });
        return false;
      });
      //监听提交
      form.on("submit(tongguo)", function (data) {
        data.field.status = 2;
        //发异步，把数据提交给php
        $.ajax({
          type: "post",
          data: data.field,
          success: function (res) {
            if (res.status == 0) {
              layer.msg(res.msg, { icon: 6, time: 1000 }, function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                parent.location.reload();
                parent.layer.close(index);
              });
            } else {
              layer.msg(res.msg, { icon: 2, time: 1000 });
            }
          },
        });
        return false;
      });
    });
  </script>
</body>